package Testinterface;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 涛
 * Date: 2023-09-14
 * Time: 22:15
 */
interface IFlying {
    public abstract void fly();
}
interface IRunning {
    public abstract void run();
}
interface ISwimming {
    public abstract void swim();
}

class Animal {
    protected String name;

    public Animal(String name) {
        this.name = name;
    }
}

class Duck extends Animal implements IFlying, IRunning, ISwimming {
    public Duck(String name) {
        super(name);
    }
    public void fly() {
        System.out.println(this.name+"正在飞");
    }
    public void run() {
        System.out.println(this.name+"正在跑");
    }
    public void swim() {
        System.out.println(this.name+"正在游泳");
    }
}

public class Test2 {
    public static void walk(IRunning running) {
        System.out.println("我带着小伙伴去散步");
        running.run();
    }
    public static void main(String[] args) {
        Duck duck = new Duck("唐老鸭");
        walk(duck);

//        Duck duck = new Duck("唐老鸭");
//        duck.fly();
//        duck.run();
//        duck.swim();
    }
}
